#include "connection_listener.h"

void network::connection_listener::run() 
{
	_sock->listen();
	while(1) {
		if(is_interrupted()) {
			return;
		}
		boost::shared_ptr<network::tcp_socket> tmp(
			new network::tcp_socket());
		if(_sock->accept(*tmp)) {
			boost::shared_ptr<network::message> msg(
				new network::message);
			msg->sock = _sock;
			msg->node = boost::shared_ptr<model::dom>();
			msg->type = network::CONNECT;
			msg->new_sock = tmp;

			_queue->put(msg);
		}
	}
}

